Skip to main content

Transform and Rotate

Rotates an image by any angle.

🖼️ Image options and parameters of transformRotate method

transformRotate method rotates image anti-clockwise at any angle that user sets. It applies the same principle as transform method, but user only needs to pass a rotation angle as a parameter instead of the whole matrix.

placeholderplaceholder
Ran in 0.00μs (Infinity ops/s)

Kinds of images compatible with algorithm

Image propertyWhat it meansPossible values
bitDepthnumber of bits per channel[8,16]
componentsnumber of componentsany
alphais alpha channel allowedtrue

Parameters and its default values

  • angle

  • options

Options

PropertyRequiredDefault value
borderTypenoconstant
borderValueno0
centernocenter
fullImageno-
heightno-
interpolationTypenobilinear
inverseno-
scaleno1
widthno-
info

Technically, transform method can still be applied to rotate an image. However it is harder. This means that ,to rotate an image by 90 degrees anti-clockwise, you can use transform method like this:

const center = image.getCoordinates('center');
return image.transform([
[0, 1, center.column - center.row],
[-1, 0, center.column + center.row],
]);

Or use transformRotate method like this:

return image.transformRotate(90);

transformRotate just facilitates this process.